<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>弹窗-新/旧客户</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="refresh" content="1200">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=86e2297f">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=222aea35">
    <link rel="stylesheet" href="/dist/plugins/fixedTable/fixed-table.css"/>
    <style>
        .table > tbody > tr > td {
            height: 30px;
            max-height: 44px;
            padding: 0 2px;
        }

        td {
            position: relative;
        }

        .table .td-value span {
            line-height: 22px;
        }

        .saveModle .top {
            height: 34px;
            line-height: 34px;
            font-size: 14px;
            font-weight: bold;
            color: #333;
            padding-left: 7px;
            border-bottom: 1px solid #cfcfcf;
            background: #fff;
        }

        .biTian {
            position: absolute;
            color: red;
            margin-left: -10px;
            margin-top: 3px;
        }

        .saveModle .top .title {
            height: 32px;
            line-height: 32px;
            font-size: 14px;
            font-weight: bold;
            color: #333;
            float: left;
            background: #fff;
        }

        .saveModle .top .btn {
            font-size: 20px;
            width: 34px;
            height: 22px;
            line-height: 12px;
            display: inline-block;
            float: right;
        }

        .saveModle .top .btn:hover {
            color: red;
        }

        .saveModle .saveBtn {
            margin: 0 auto;
            margin-top: 35px;
            display: block;

        }

        span.lineOne {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        p {
            display: inline-block;
            margin-bottom: 0px;
            line-height: 25px;
            padding-right: 15px;
            color: #228bee;
            font-size: 14px;
        }

        .td-value span.lineOne {
            overflow: hidden;
            text-overflow: ellipsis;
            color: black !important;
            /*display: -webkit-box;*/
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            max-height: 34px;
        }

        .td-value {
            text-align: left !important;
            vertical-align: middle;
            word-wrap: break-word;
            color: #2a8cec !important;
        }

        td {
            height: 47.78px;
        }

        .td-value span {
            display: inline-block;
            overflow: hidden;
            padding-left: 0.06rem;
            word-wrap: break-word;
            color: black !important;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .fixed-table_body tr td {
            border-right: none;
            font-size: 12px;
            text-align: center;
        }

        .fixed-table_header tr th {
            border-right: none;
            background: yellow;
            font-weight: normal;
            font-size: 12px;
        }

        .nav > li > a {
            padding: 10px 10px;
        }


        .nav-tabs-custom > .nav-tabs > li.active {
            color: #2a8cec;
        }

        .nav-tabs-custom > .nav-tabs > li.active > a, .nav-tabs-custom > .nav-tabs > li.active:hover > a {
            background: #fff;
            color: #2a8cec;
            border-top-left-radius: 0px;
            border-top-right-radius: 0px;
        }


        .nav-tabs-custom > .nav-tabs {
            /*border-bottom-color: #fff;*/
        }

        .model-picker-dropdown {
            position: absolute;
            width: 315px;
            left: -9999px;
            top: -9999px;
            outline: 0;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            z-index: 999999;
            display: none;
            min-width: 200px;
            margin-bottom: 20px;
            margin-top: 5px;
        }

        .model-select {
            font-size: 16px;
        }

        .model-select dl {
            line-height: 2;
            clear: both;
            padding: 3px 0;
            margin: 0;
            max-height: 200px;
            overflow-y: scroll;
        }

        .model-select-content {
            width: 100%;
            min-height: 50px;
            background-color: #fff;
            padding: 5px 5px;
        }

        .model-select a:hover,
        .model-select a:focus {
            background-color: #f1f8ff;
            border-radius: 2px;
            color: #46A4FF;
        }

        .model-select a.active {
            background-color: #46A4FF;
            color: #fff;
            border-radius: 2px;
        }

        .td-value span {
            padding-left: 6px;
        }

        textarea {
            height: 56px;
            width: 100%;
            border: none;
            outline: none;
            -webkit-appearance: none;
            resize: none;
            padding-top: 20px;
            padding-left: 20px;
        }

        .textareaSpan {
            max-height: 56px;
            line-height: 18px !important;
            overflow: hidden !important;
            text-overflow: ellipsis;
            display: -webkit-box !important;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
        }

        label {
            font-weight: normal;
            margin-bottom: 0px;
        }

        .userName {
            text-align: justify !important;
            display: inline-block !important;
            overflow: hidden !important;
            vertical-align: middle !important;
            height: 24px !important;
            line-height: 24px !important;
            width: 46px !important;
        }

        .userName:after {
            content: " ";
            display: inline-block;
            width: 100%;
        }

        .checkBoxToRadio {
            padding-top: 0.5px;
            background-color: #DEDEDE;
            border: 1px solid #a8a8a8;
            width: 12px;
            height: 12px;
            line-height: 8px;
            text-align: center;
            position: absolute;
            top: 8px;
            border-radius: 3px;
            color: #424242;
            font-weight: bold;
            font-size: 10px;
            cursor: pointer;
        }
    </style>
</head>
<body>
<section id="app" style="text-align: center; height: auto;" v-cloak class="iframeH">
    <div class="div-td-content-more"><i></i></div>
    <div class="oaLoad">
        <div class="loadGif" id="areaProgress"></div>
    </div>
    <div class="model-picker-dropdown">
        <div class="model-select-wrap">
            <div class="model-select-tab">
                <a class="active" data-count="type">省</a>
                <a class="" data-count="brand">市</a>
                <a class="" data-count="model">县</a>
            </div>
            <div class="model-select-content">
                <div class="model-select type" data-count="type" style="display: block;">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="item in itemsType">{{item.name}}</a>
                    </dl>
                </div>
                <div class="model-select brand" data-count="province">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in itemsBran">{{item.name}}</a>
                    </dl>
                </div>
                <div class="model-select model" data-count="model">
                    <dl class="clearfix">
                        <a class="" :attr-id="item.id" v-for="(item,i) in itemsMod">{{item.name}}</a>
                    </dl>
                </div>
            </div>
        </div>
    </div>
    <table class="table table-detail table-bordered text-center" cellspacing="0">
        <thead>
        <tr>
            <th class="tableTitle" colspan="8" v-if="pageType == 'look'">来电详情查看</th>
            <th class="tableTitle" colspan="8" v-else>来电登记</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td class="td-title">登记时间</td>
            <td class="td-value">
                <span>  {{params.createTime}}</span>
            </td>
            <td class="td-title">登记人姓名</td>
            <td class="td-value">
                <input type="text" v-model="params.createUserName" v-if="pageType == 'edit'">
                <span v-else class="userName" style="text-align: justify !important;">{{params.createUserName}}</span>
            </td>
            <td colspan="4"></td>
        </tr>
        <tr>
            <td class="td-title"><i class="biTian">*</i><span>来电号码</span></td>
            <td class="td-value">
                <input class="" type="text" v-model="params.callerTel"
                       v-if="pageType == 'edit'" id="callerTel">
                <span v-else>{{params.callerTel}}</span>
            </td>
            <td class="td-title"><i class="biTian">*</i>来电人姓名</td>
            <td class="td-value">
                <input type="text" v-if="pageType == 'edit'" v-model="params.callerName" id="callerName">
                <span v-else class="userName" style="text-align: justify !important;">{{params.callerName}}</span>
            </td>
            <td class="td-title">客户姓名</td>
            <td class="td-value">
                <input type="text" v-model="params.customerName" id="customerName" v-if="pageType == 'edit'"/>
                <span v-else class="userName" style="text-align: justify !important;">{{params.customerName}}</span>
            </td>
            <td class="td-title">客户电话</td>
            <td class="td-value">
                <input type="text" v-if="pageType == 'edit'" v-model="params.customerTel"/>
                <span v-else>{{params.customerTel}}</span>
            </td>
        </tr>
        <tr>
            <td class="td-title"><i class="biTian">*</i>来电人类型</td>
            <td colspan="3" class="td-value" :style="pageType == 'edit'?'padding-left: 6px !important;':''">
                <template v-if="pageType == 'edit'">
                    <label style="width: 20%;float: left;" v-for="item in callerTypeList">
                        <input name="customerType" type="radio" v-model="params.callerType"
                               :value="item.key" style="vertical-align: -4px;display: none"/>
                        <div v-if="params.callerType!=item.key" class="checkBoxToRadio">
                        </div>
                        <div v-else class="checkBoxToRadio">
                            ✔
                        </div>
                        <span class="userName"
                              style="text-align: justify !important; width: 52px !important;padding-left: 3px;float: left;margin-left: 14px;">{{item.value}}</span>
                    </label>
                </template>
                <template v-else>
                    <span style="text-align: left;">{{getCallerType(params.callerType)}}</span>
                </template>
            </td>
            <td class="td-title">所属区域</td>
            <td class="td-value" colspan="3">
                <input type="text" class="selectModel" :value="showDz()" v-if="pageType == 'edit'">
                <span v-if="pageType != 'edit'&&params.provinceName&&params.cityName&&params.countyName">{{params.provinceName}}-{{params.cityName}}-{{params.countyName}}</span>
            </td>
        </tr>
        <tr>
            <td class="td-title" style="height: 60px;"><i class="biTian">*</i>来电内容登记</td>
            <td colspan="7" style="height: 60px;" class="td-value">
                <textarea style="line-height: 24px; padding-top: 0px !important;  height: 44px;"
                          v-model="params.content" v-if="pageType == 'edit'">
                </textarea>
                <span v-else class="textareaSpan">{{params.content}}</span>
            </td>
        </tr>
        <tr v-if="deviceList&&deviceList.length>0">
            <td colspan="8">
                <table id="deviceList" style="width: 100%;height:100%;margin: auto;border: 0px;table-layout: auto;"
                       class="table  text-center table-bordered">
                    <tr>
                        <th class="tableTitle" colspan="4" style="border: 0px;">设备列表</th>
                    </tr>
                    <tr>
                        <td class="td-title" style="width: 136px;">设备品牌</td>
                        <td class="td-title">设备类型</td>
                        <td class="td-title">设备型号</td>
                        <td class="td-title">设备序列号</td>
                    </tr>
                    <tr v-for="(device,i) in deviceList">
                        <td style="width: 136px;text-align: center;color: #2a8cec;">
                            <lable>
                                <input type="radio" v-if="pageType == 'edit'" style="vertical-align: -2px;"
                                       v-bind:value="i" v-model="deviceListIndex"/>
                                {{device.deviceBrand}}
                            </lable>
                        </td>
                        <td style="text-align: center;color: #2a8cec">{{device.deviceType}}</td>
                        <td style="text-align: center;color: #2a8cec">{{device.deviceModel}}</td>
                        <td style="text-align: center;color: #2a8cec">{{device.sequence}}</td>
                    </tr>

                </table>
            </td>
        </tr>
        <tr>
            <td class="td-title"><i class="biTian">*</i>来电类型</td>
            <td colspan="7" class="td-value" :style="pageType == 'edit'?'padding-left: 6px !important;':''">
                <template v-if="pageType == 'edit'">
                    <label style="width: 25%;float: left;" v-for="item in callTypeList">
                        <input name="callType" type="radio" v-model="params.callType"
                               :value="item.key" style="vertical-align: -4px;display: none"/>
                        <div v-if="params.callType!=item.key" class="checkBoxToRadio">
                        </div>
                        <div v-else class="checkBoxToRadio">
                            ✔
                        </div>
                        <span class="userName"
                              style="text-align: justify !important; width: 52px !important;padding-left: 3px;float: left;margin-left: 14px;">{{item.value}}</span>
                    </label>
                </template>
                <template v-else>
                    <span>{{getCallType(params.callType)}}</span>
                </template>
            </td>
        </tr>
        <tr v-if="pageType != 'edit'">
            <td class="td-title">受理部门</td>
            <td class="td-value"><span>{{params.acceptDepart}}</span></td>
            <td class="td-title">受理责任人</td>
            <td class="td-value"><span>{{params.acceptName}}</span></td>
            <td class="td-title">手机号码</td>
            <td class="td-value"><span>{{params.acceptTel}}</span></td>
            <td class="td-title">发送短信</td>
            <td class="td-value"><span>{{params.messageFlag=="1"?"是":"否"}}</span></td>
        </tr>
        <tr style="height:30px;" v-if="pageType != 'edit'">
            <td class="td-title">电话是否解决</td>
            <td colspan="2" class="td-value">
                <span>{{params.phoneFlag=="1"?"是":"否"}}</span>
            </td>
            <td colspan="5"></td>
        </tr>
        </tbody>
    </table>
    <div>
        <input type="button" value="确定" class="btn oaBtn  btn-sm" v-if="pageType == 'edit'" @click="save()">
    </div>

</section>
<!--JQ-->
<!--插件JS-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<script>window.jQuery || document.write('<script src="/dist/plugins/jQuery/jquery-2.2.3.min.js"><\/script>', '<script src="/dist/plugins/bootstrap/js/bootstrap.min.js"><\/script>', '<script src="/dist/plugins/vue/vue.min.js"><\/script>')</script>
<script src="/dist/plugins/jQuery/jquery.cookie.min.js"></script>
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<!--<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>-->
<script src="/dist/plugins/fixedTable/fixed-table.js"></script>
<script src="enum.js"></script>
<script type="text/javascript">
    var api = frameElement.api;
    $(function () {
        $("body").on("click", ".lineOne,.textareaSpan", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px",
                        "text-align": "left",
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
    $(function () {
        $("body").on("click", ".selectModel", function (e) {
            if ($(".model-picker-dropdown").is(":hidden")) {
                $(".model-picker-dropdown").css({
                    "width": $(this).outerWidth() + "px",
                    "left": $(this).offset().left - 76,
                    "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                }).show();
                e.stopPropagation();
            } else {
                $(".model-picker-dropdown").hide();
            }
        });
        $("body").on("click", ".model-select-tab a", function (e) {
            $(this).parent().find("a").removeClass("active");
            $(this).addClass("active");
            var boxName = $(this).attr("data-count");
            $(".model-select").hide();
            $(".model-select-content" + " ." + boxName).show();

        });
        $("body").on("click", ".model-select  a", function (e) {
            if ($(this).hasClass("active")) {
                return false;
            }
            $(this).parent().find("a").removeClass("active");
            var id = $(this).attr("attr-id");
            $(this).addClass("active");
            var val = $(this).text();
            if ($(this).parents(".model-select").hasClass("type")) {
                $(".model-select-tab a").removeClass("active");
                $(".model-select-tab a[data-count=brand]").addClass("active");
                $(".model-select").hide();
                app.params.provinceName = val;
                app.params.cityName = '';
                app.params.countyName = '';
                app.getCity(id);
                $(".model-select-content .brand").show();

            } else if ($(this).parents(".model-select").hasClass("brand")) {
                $(".model-select-tab a").removeClass("active");
                var id = $(this).attr("attr-id");
                $(".model-select-tab a[data-count=model]").addClass("active");
                $(".model-select").hide();
                app.params.cityName = val;
                app.params.countyName = '';
                app.getCounty(id);
                $(".model-select-content .model").show();

            } else {
                app.params.countyName = val;
                $(".model-picker-dropdown").hide();
            }
        })
        $("body").on("click", ".model-picker-dropdown", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".model-picker-dropdown").hide();
        });
    });


</script>
<script type="text/javascript">
    Vue.directive('onedate', {
        // 当被绑定的元素插入到 DOM 中时……
        update: function (el, binding) {
            // 聚焦元素
            if (app.pageType != 'add') {
                if (el.value == "NaN.undefined" || el.value == "") {
                    el.value = binding.value
                }
            }
        },
        componentUpdated: function (el, binding) {
            // 聚焦元素
        }
    })


    var app = new Vue({
        el: '#app',
        data: {
            pageType: $.wyui.page.urlParams.pageType ? $.wyui.page.urlParams.pageType : 'look',
            id: $.wyui.page.urlParams.mainId,
            itemsBran: [],
            itemsType: [],
            itemsMod: [],
            flag: false,
            mainId: '',
            isCheckedAll: false,
            params: {
                createTime: '',
                callerTel: '',
                callerName: '',
                customerId: '',
                customerName: '',
                customerTel: '',
                callerType: '',
                callType: '',
                provinceName: '',
                cityName: '',
                countyName: '',
                createUserName: getCurrentUser().name,
                createUserId: getCurrentUser().id,
            },
            callTypeList: [],
            devices: [],
            callerTypeList: [],
            lists: [],
            customer: [],
            deviceList: [],
            deviceListIndex: -1,
            pageType: $.wyui.page.urlParams.pageType,
        },

        methods: {
            checkBox1: function (event, classType) {
                if ($(event.target).prop("checked") == false) { //判断当前对象为不选中
                    $(event.target).prop("checked", false);  //去除当前对象的选中状态
                } else {  //判断当前对象为选中状态
                    $("." + classType).each(function () {  //通过循环CheckBox的class所有CheckBox均不选中
                        $(this).prop("checked", false);
                    });
                    $(event.target).prop("checked", true); //设置当前对象选中(因为在上面循环时把当前的状态变为不选中)
                }
            },
            showDatePicker: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.params.createTime = dp.cal.getNewDateStr();
                        return true;
                    },
                    dateFmt: 'yyyy-MM-dd HH:mm:ss'
                });
                $(e.target).blur();
            },
            showDz: function () {
                var html = '';
                if (this.params.provinceName) {
                    html += this.params.provinceName;
                }
                if (this.params.cityName != '') {
                    html += "-" + this.params.cityName;
                }
                if (this.params.countyName != '') {
                    html += "-" + this.params.countyName;
                }
                return html;
            },
            hiddenDivModel: function () {
                $("#countyIdel").hide();
            },
            getIntentionModel: function () {
                var that = this;
                that.customer.provinceName = $("#provinceN option:selected").text();
                that.customer.cityName = $("#cityN option:selected").text();
                that.customer.countyName = $("#countyN option:selected").text();
                $("#countyIdel").hide();
            },
            selectDevice: function (i) {
                var that = this;
                if (that.deviceList && that.deviceList.length > 0) {
                    that.devices = deviceList[i];
                    alert('选择成功')
                }
            },
            getCity: function (id) {
                var that = this;
                that.cityId = "市区";
                that.countyId = "县";
                that.itemsMod = "";
                var data = {};
                $.wyui.postMethod('/intentCustomer/getForProvinceById.json', {'id': id}, function (r) {
                    console.log(r);
                    that.itemsBran = r.records;
                })
            },
            getCounty: function (id) {
                var that = this;
                $.wyui.postMethod('/intentCustomer/getForProvinceById.json', {'id': id}, function (r) {
                    console.log(r);
                    that.itemsMod = r.records;
                })

            },
            getCallTypeList: function () {
                var that = this;
                $.wyui.postMethod("/serveEnum/getEnumByModuleType.json", {moduleType: "callType"}, function (data) {
                    that.callTypeList = data;

                });
            },
            getCallerTypeList: function () {
                var that = this;
                $.wyui.postMethod("/serveEnum/getEnumByModuleType.json", {moduleType: "callerType"}, function (data) {
                    that.callerTypeList = data;

                });
            },
            getDeviceList: function () {
                var that = this;
                if (that.params.customerId && that.params.customerId != '') {
                    $.wyui.postMethod("/serveDevice/getDeviceListByCustomerId.json", {customerId: that.params.customerId}, function (data) {
                        that.deviceList = data;
                    });
                }
            },
            getCallerTypeMap: function (key) {
                var that = this;
                if (that.callerTypeMap.size > 0) {
                    return that.callerTypeMap.get(key);
                } else {
                    return '';
                }
            },
            getCallTypeMap: function (key) {
                var that = this;
                if (that.callTypeMap.size > 0) {
                    return that.callTypeMap.get(key);
                } else {
                    return '';
                }
            },
            showModel: function (width, title) {
                $.alert({type: 'topAlert', width: width, title: title})
            },
            save: function () {
                var that = this;
                if (!that.params.callerTel || that.params.callerTel.length < 11) {
                    alert('来电人手机号码格式不正确！');
                    return false;
                }
                if (!that.params.callerName) {
                    alert("来电人姓名为必填项")
                    return false;
                }
                if (!that.params.callerType) {
                    alert("来电人类型为必填项")
                    return false;
                }
                if (!that.params.content) {
                    alert("来电内容登记为必填项")
                    return false;
                }
                if (!that.params.callType) {
                    alert("来电类型为必填项")
                    return false;
                }
                var device = {};
                if (that.deviceListIndex != -1) {
                    device = that.deviceList[that.deviceListIndex];
                }
                var data = {
                    customer: {
                        customerName: that.params.customerName,
                        customerTel: that.params.customerTel,
                        id: that.params.customerId
                    },
                    main: that.params,
                    devices: device,
                }

                $.wyui.postMethod('/serveMain/saveMore.json', trimRN(data), function (r) {
                    //that.showModel(200, "保存成功")
                    var $iframe = top.findIframeByName("400");
                    $iframe[0].contentWindow.$("#iframeBox")[0].contentWindow.app.getList();
                    var id = r.mainId;
                    var title = '';
                    var url = '';
                    if (id && id != '') {
                        if (that.params.callType == 'repairOrder') {
                            url = '&type=repairOrder';
                            title = '报修单';
                            top.closeTabByPageId("repairOrder");
                            top.addTabs({
                                id: that.params.callType,
                                title: title,
                                close: true,
                                url: '/serve/repairinfo.html?id=' + id + "&pageType=edit",
                            });
                        } else if (that.params.callType == 'machineConsultation' || that.params.callType == 'accessoriesConsultation' || that.params.callType == 'other') {
                            url = '&type=' + that.params.callType;
                            title = getCallType(that.params.callType);
                            top.closeTabByPageId(that.params.callType);
                            top.addTabs({
                                id: that.params.callType,
                                title: title,
                                close: true,
                                url: '/serve/businessDetails.html?id=' + id + "&pageType=edit" + url,
                            });
                        }

                    }

                    api.close();
                });

            }
        },
        mounted: function () {
            var that = this;
            /*获取省份*/

            that.params.createUserId = getCurrentUser().id;
            that.params.createUserName = getCurrentUser().name;

            if (that.pageType == "look") {
                $.wyui.postMethod('/serveMain/getServeMainById.json', {mainId: that.id}, function (r) {
                    that.params = r;
                });
            } else if (that.pageType == "edit") {
                $.wyui.postMethod('/intentCustomer/getForProvinceById.json', {'id': '0'}, function (r) {
                    that.itemsType = r.records;
                })

            }
            that.getCallerTypeList();
            that.getCallTypeList();
            setTimeout(function () {
                getServe
            }, 300);
        },
    });


</script>
<script>
    $(function () {
        getServe();
    });

    function getServe() {
        //客户姓名
        $("#customerName").autoComplete({
            url: server.ip + "/serveUser/getServeUserInfoTop10.json",
            render: function (data, panel) {
                data = data.sendData;
                for (var i = 0; i < data.length; i++) {
                    $("<li></li>").data("autoComplete",
                        data[i]).html("<a>" + data[i].customerName + "(" + data[i].customerTel + ")</a>")
                        .appendTo(panel);
                }
            },
            selected: function (user) {
                app.params.customerName = user.customerName;
                app.params.customerTel = user.customerTel;
                app.params.customerId = user.customerId;
                app.getDeviceList();
                return false;
            },
            height: 210,
            width: 300
        });
        $("#callerTel").autoComplete({
            url: server.ip + "/serveUser/getServeUserInfoTop10ByCallerTel.json",
            render: function (data, panel) {
                data = data.sendData;
                for (var i = 0; i < data.length; i++) {
                    $("<li></li>").data("autoComplete",
                        data[i]).html("<a>" + data[i].callerName + "(" + data[i].callerTel + ")</a>")
                        .appendTo(panel);
                }
            },
            selected: function (user) {
                app.params.customerName = user.customerName;
                app.params.customerTel = user.customerTel;
                app.params.customerId = user.customerId;
                app.params.callerName = user.callerName;
                app.params.callerTel = user.callerTel;
                app.params.callerId = user.callerId;
                app.getDeviceList();
                return false;
            },
            height: 210,
            width: 300
        });
        $("#callerName").autoComplete({
            url: server.ip + "/serveUser/getServeUserInfoTop10ByCallerName.json",
            render: function (data, panel) {
                data = data.sendData;
                for (var i = 0; i < data.length; i++) {
                    $("<li></li>").data("autoComplete",
                        data[i]).html("<a>" + data[i].callerName + "(" + data[i].callerTel + ")</a>")
                        .appendTo(panel);
                }
            },
            selected: function (user) {
                app.params.customerName = user.customerName;
                app.params.customerTel = user.customerTel;
                app.params.callerName = user.callerName;
                app.params.callerTel = user.callerTel;
                app.params.customerId = user.customerId;
                app.params.callerId = user.callerId;
                app.getDeviceList();
                return false;
            },
            height: 210,
            width: 300
        });
    };
</script>
</body>
</html>